import {getFileType} from "../../../utils/index.js";

var vm = new Vue({
    el: '#app',
    data: {
        tableData: [],
        total: 50,
        page_size: 10,
        current_page: 1,
        selectOption: [],
        iedId:''

    },
    methods: {
        getValue: function(){
            console.log('您选择了', this.iedId)
            this.getConfigList();
        },
        // 搜索
        handleFilter() {
            this.getConfigList();
        },
        resetTime() {
            this.iedId = this.selectOption[0].id;
            this.getConfigList();
        },
        handleSizeChange: function (val) {
            vm.page_size = val;
            this.getConfigList();
        },
        handleCurrentChange: function (val) {
            vm.current_page = val;
            this.getConfigList();
        },

        getConfigList: function () {
            console.log(this.iedId);
            $.ajax({
                url: context + 'ICDImportConfig/getNodeInfo?page=' + this.current_page + '&page_size=' + this.page_size+ '&iedId=' + this.iedId,
                type: 'GET',
                success: function (res) {
                    console.log(res);
                    vm.tableData = res.data.sysNodeList;
                    vm.total = res.data.total;
                    vm.page_size = res.data.page_size;
                    vm.current_page = res.data.page;
                }
            });
        },

        getLEDList: function () {
            $.ajax({
                url: context + 'ICDImportConfig/getLEDList',
                type: 'GET',
                success: function (res) {
                    console.log(res);
                    debugger
                    vm.selectOption = res.data.selectOption;
                    debugger
                    vm.iedId = vm.selectOption[0].id;
                    vm.getConfigList();
                }
            });
        }
    },
    mounted: function () {
        this.getLEDList();
    }
});
